package com.min.nio;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;

/**
 * Created by min on 2017/9/7.
 */
public class MyServer {

    public static void main(String[] args) throws IOException {

        //1 打开ServerSocketChannel 用于监听客户端的连接。
        ServerSocketChannel acceptorSvr = ServerSocketChannel.open();
        //2 绑定监听端口，设置连接为非阻塞模式。
        acceptorSvr.socket().bind(new InetSocketAddress("127.0.0.1",8089));
        acceptorSvr.configureBlocking(false);
        //3 创建Selector 线程，创建多路复用器并且启动线程
        Selector selector = Selector.open();

    }
}
